package com.quanshu.change.person.adapter;

import android.support.annotation.Nullable;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.quanshu.change.person.entity.GoldListBean;
import com.quanshu.exchange.R;

import java.util.List;

/**
 * 作者  李哲
 * 创建时间 2018/9/1
 * 邮箱 lizhetongliao@163.com
 * 说明
 **/
public class GoldChargeAdapter extends BaseQuickAdapter<GoldListBean.NumberEntity, BaseViewHolder> {
    public GoldChargeAdapter(@Nullable List<GoldListBean.NumberEntity> data) {
        super(R.layout.item_gold_charge, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, GoldListBean.NumberEntity item) {
        TextView textView = helper.getView(R.id.back_ground);
        TextView textView1 = helper.getView(R.id.number);
        TextView textView2 = helper.getView(R.id.money);
        if (item.isSelect()) {
            textView.setEnabled(false);
            textView1.setEnabled(false);
            textView2.setEnabled(false);
        } else {
            textView.setEnabled(true);
            textView1.setEnabled(true);
            textView2.setEnabled(true);
        }
        int a = Integer.parseInt(item.getNumber());
        int b = Integer.parseInt(item.getAdd_number());
        textView1.setText(String.valueOf(a + b) + "金豆");
        textView2.setText("¥ "+item.getNumber());
        helper.addOnClickListener(R.id.item_root);
    }
}
